﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows.Forms;

namespace Chanjet.TP.OpenAPI.Demo
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Process currprocess = Process.GetCurrentProcess();

            string processName = currprocess.ProcessName;

            Process[] proces = Process.GetProcessesByName(processName);

            if (proces.Length > 1)
            {
                foreach (Process item in proces)
                {
                    if (item.ProcessName == processName) //说明线程名称一样
                    {
                        if (item.Id != currprocess.Id) //线程名称一样，但是线程id不一样
                        {
                            MessageBox.Show("已经有一个程序在运行！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);

                            currprocess.Kill();

                            return;
                        }
                    }
                }
            }
            Convert.ToBase64String(System.Text.UTF8Encoding.UTF8.GetBytes(""));
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }

    public enum AccountCharacterEnum
    {
        //工业
        Industry,
        //商业
        Commercy
    }

    public class TestClass
    {
        public void TestMethod(int a)
        {
            throw new ArgumentOutOfRangeException("a");
        }
    }
}
